.TH IP\-NEXTHOP 8 "30 May 2019" "iproute2" "Linux"
.SH "NAME"
ip-nexthop \- nexthop object management
.SH "SYNOPSIS"
.sp
.ad l
.in +8
.ti -8
.B ip
.RI "[ " ip-OPTIONS " ]"
.B nexthop
.RI " { " COMMAND " | "
.BR help " }"
.sp
.ti -8

.ti -8
.BR "ip nexthop" " { "
.BR show " | " flush " } "
.I  SELECTOR

.ti -8
.BR "ip nexthop" " { " add " | " replace " } id "
.I ID
.IR  NH

.ti -8
.BR "ip nexthop" " { " get " | " del " } id "
.I  ID

.ti -8
.BI "ip nexthop bucket list " BUCKET_SELECTOR

.ti -8
.BR "ip nexthop bucket get " id
.I  ID
.RI "index " INDEX

.ti -8
.IR SELECTOR " := "
.RB "[ " id
.IR ID " ] [ "
.B  dev
.IR DEV " ] [ "
.B  vrf
.IR NAME " ] [ "
.B  master
.IR DEV " ] [ "
.BR  groups " ] [ "
.BR  fdb " ]"

.ti -8
.IR BUCKET_SELECTOR " := "
.IR SELECTOR
.RB " | [ " nhid
.IR ID " ]"

.ti -8
.IR NH " := { "
.BR blackhole " | [ "
.B  via
.IR ADDRESS " ] [ "
.B  dev
.IR DEV " ] [ "
.BR onlink " ] [ "
.B encap
.IR ENCAP " ] [ "
.BR fdb " ] | "
.B  group
.IR GROUP " [ "
.BR fdb " ] [ "
.B type
.IR TYPE " [ " TYPE_ARGS " ] ] }"

.ti -8
.IR ENCAP " := [ "
.IR ENCAP_MPLS " ] "

.ti -8
.IR ENCAP_MPLS " := "
.BR mpls " [ "
.IR LABEL " ] ["
.B  ttl
.IR TTL " ]"

.ti -8
.IR GROUP " := "
.BR id "[," weight "[/...]"

.ti -8
.IR TYPE " := { "
.BR mpath " | " resilient " }"

.ti -8
.IR TYPE_ARGS " := [ "
.IR RESILIENT_ARGS " ] "

.ti -8
.IR RESILIENT_ARGS " := "
.RB "[ " buckets
.IR BUCKETS " ] [ "
.B  idle_timer
.IR IDLE " ] [ "
.B  unbalanced_timer
.IR UNBALANCED " ]"

.SH DESCRIPTION
.B ip nexthop
is used to manipulate entries in the kernel's nexthop tables.
.TP
ip nexthop add id ID
add new nexthop entry
.TP
ip nexthop replace id ID
change the configuration of a nexthop or add new one
.RS
.TP
.BI via " [ FAMILY ] ADDRESS"
the address of the nexthop router, in the address family FAMILY.
Address family must match address family of nexthop instance.
.TP
.BI dev " NAME"
is the output device.
.TP
.B onlink
pretend that the nexthop is directly attached to this link,
even if it does not match any interface prefix.
.TP
.BI encap " ENCAPTYPE ENCAPHDR"
attach tunnel encapsulation attributes to this route.
.sp
.I ENCAPTYPE
is a string specifying the supported encapsulation type. Namely:

.in +8
.BI mpls
- encapsulation type MPLS
.sp
.in -8
.I ENCAPHDR
is a set of encapsulation attributes specific to the
.I ENCAPTYPE.

.in +8
.B mpls
.in +2
.I MPLSLABEL
- mpls label stack with labels separated by
.I "/"
.sp

.B ttl
.I TTL
- TTL to use for MPLS header or 0 to inherit from IP header
.in -2

.TP
.BI group " GROUP [ " type " TYPE [ TYPE_ARGS ] ]"
create a nexthop group. Group specification is id with an optional
weight (id,weight) and a '/' as a separator between entries.
.sp
.I TYPE
is a string specifying the nexthop group type. Namely:

.in +8
.BI mpath
- Multipath nexthop group backed by the hash-threshold algorithm. The
default when the type is unspecified.
.sp
.BI resilient
- Resilient nexthop group. Group is resilient to addition and deletion of
nexthops.

.sp
.in -8
.I TYPE_ARGS
is a set of attributes specific to the
.I TYPE.

.in +8
.B resilient
.in +2
.B buckets
.I BUCKETS
- Number of nexthop buckets. Cannot be changed for an existing group
.sp

.B idle_timer
.I IDLE
- Time in seconds in which a nexthop bucket does not see traffic and is
therefore considered idle. Default is 120 seconds

.B unbalanced_timer
.I UNBALANCED
- Time in seconds in which a nexthop group is unbalanced and is therefore
considered unbalanced. The kernel will try to rebalance unbalanced groups, which
might result in some flows being reset. A value of 0 means that no
rebalancing will take place. Default is 0 seconds
.in -2

.TP
.B blackhole
create a blackhole nexthop
.TP
.B fdb
nexthop and nexthop groups for use with layer-2 fdb entries.
A fdb nexthop group can only have fdb nexthops.
Example: Used to represent a vxlan remote vtep ip. layer-2 vxlan
fdb entry pointing to an ecmp nexthop group containing multiple
remote vtep ips.
.RE

.TP
ip nexthop delete id ID
delete nexthop with given id.

.TP
ip nexthop show
show the contents of the nexthop table or the nexthops
selected by some criteria.
.RS
.TP
.BI dev " DEV "
show the nexthops using the given device.
.TP
.BI vrf " NAME "
show the nexthops using devices associated with the vrf name
.TP
.BI master " DEV "
show the nexthops using devices enslaved to given master device
.TP
.BI groups
show only nexthop groups
.TP
.BI fdb
show only fdb nexthops and nexthop groups
.RE
.TP
ip nexthop flush
flushes nexthops selected by some criteria. Criteria options are the same
as show.

.TP
ip nexthop get id ID
get a single nexthop by id

.TP
ip nexthop bucket show
show the contents of the nexthop bucket table or the nexthop buckets
selected by some criteria.
.RS
.TP
.BI id " ID "
.in +0
show the nexthop buckets that belong to a nexthop group with a given id
.TP
.BI nhid " ID "
.in +0
show the nexthop buckets that hold a nexthop with a given id
.TP
.BI dev " DEV "
.in +0
show the nexthop buckets using the given device
.TP
.BI vrf " NAME "
.in +0
show the nexthop buckets using devices associated with the vrf name
.TP
.BI master " DEV "
.in +0
show the nexthop buckets using devices enslaved to given master device
.RE

.TP
ip nexthop bucket get id ID index INDEX
get a single nexthop bucket by nexthop group id and bucket index

.SH EXAMPLES
.PP
ip nexthop ls
.RS 4
Show all nexthop entries in the kernel.
.RE
.PP
ip nexthop add id 1 via 192.168.1.1 dev eth0
.RS 4
Adds an IPv4 nexthop with id 1 using the gateway 192.168.1.1 out device eth0.
.RE
.PP
ip nexthop add id 2 encap mpls 200/300 via 10.1.1.1 dev eth0
.RS 4
Adds an IPv4 nexthop with mpls encapsulation attributes attached to it.
.RE
.PP
ip nexthop add id 3 group 1/2
.RS 4
Adds a nexthop with id 3. The nexthop is a group using nexthops with ids
1 and 2 at equal weight.
.RE
.PP
ip nexthop add id 4 group 1,5/2,11
.RS 4
Adds a nexthop with id 4. The nexthop is a group using nexthops with ids
1 and 2 with nexthop 1 at weight 5 and nexthop 2 at weight 11.
.RE
.PP
ip nexthop add id 5 via 192.168.1.2 fdb
.RS 4
Adds a fdb nexthop with id 5.
.RE
.PP
ip nexthop add id 7 group 5/6 fdb
.RS 4
Adds a fdb nexthop group with id 7. A fdb nexthop group can only have
fdb nexthops.
.RE
.PP
ip nexthop add id 10 group 1/2 type resilient buckets 32
.RS 4
Add a resilient nexthop group with id 10 and 32 nexthop buckets.
.RE
.SH SEE ALSO
.br
.BR ip (8)

.SH AUTHOR
Original Manpage by David Ahern <dsahern@kernel.org>
